---
title: Button
description: Displays a button or a component that looks like a button.
component: true
kobalte:
    link: https://kobalte.dev/docs/core/components/button
    api: https://kobalte.dev/docs/core/components/button#api-reference
---

<ComponentPreview name="button-demo" />

## Installation

<Tabs defaultValue="cli">

<TabsList>
	<TabsTrigger value="cli">CLI</TabsTrigger>
	<TabsTrigger value="manual">Manual</TabsTrigger>
	<TabsIndicator class="bg-primary" />
</TabsList>

<TabsContent value="cli">

```bash
npx shadcn-solid@latest add button
```

</TabsContent>

<TabsContent value="manual">

<Steps>

<Step>Install the following dependencies:</Step>

```bash
npm install @kobalte/core
```

<Step>Copy and paste the following code into your project.</Step>

<ComponentSource name="button" />

<Step>Update the import paths to match your project setup.</Step>

</Steps>

</TabsContent>

</Tabs>

## Usage

```tsx
import { Button } from "@/components/ui/button"
```

```tsx
<Button variant="outline">Button</Button>
```

### Link

You can use the `buttonVariants` helper to create a link that looks like a button.

```tsx
import { buttonVariants } from "@/components/ui/button"
```

```tsx
<A className={buttonVariants({ variant: "outline" })}>Click here</A>
```

Alternatively, you can set the `asChild` parameter and nest the link component.

```tsx
<Button asChild>
	<As component={A} href="/login">
		Login
	</As>
</Button>
```

## Examples

### Primary

<ComponentPreview name="button-demo" />

### Secondary

<ComponentPreview name="button-secondary" />

### Destructive

<ComponentPreview name="button-destructive" />

### Outline

<ComponentPreview name="button-outline" />

### Ghost

<ComponentPreview name="button-ghost" />

### Link

<ComponentPreview name="button-link" />

### With Icon

<ComponentPreview name="button-with-icon" />

### Loading

<ComponentPreview name="button-loading" />

### As Child

<ComponentPreview name="button-as-child" />
